package com.lzb.permanentcalendar.dialog;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;

import androidx.annotation.NonNull;

import com.lzb.permanentcalendar.R;
import com.lzb.permanentcalendar.basic.dialog.BaseSmartDialog;
import com.lzb.permanentcalendar.databinding.DialogScheduleTypeBinding;
import com.lzb.permanentcalendar.databinding.DialogSelRemindBinding;

import java.util.ArrayList;
import java.util.List;

public class ScheduleTypeDialog extends BaseSmartDialog<DialogScheduleTypeBinding> implements View.OnClickListener {


    public ScheduleTypeDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getGravity() {
        return Gravity.BOTTOM;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_schedule_type;
    }

    @Override
    protected void initView(View view) {
        mDataBinding.tvType1.setOnClickListener(this);
        mDataBinding.tvType2.setOnClickListener(this);
        mDataBinding.tvType3.setOnClickListener(this);
        mDataBinding.tvType4.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.tvType1) {
            dismiss();
            if (listener != null) {
                listener.click(getContext().getString(R.string.schedule_type_text1));
            }
        } else if (id == R.id.tvType2) {
            dismiss();
            if (listener != null) {
                listener.click(getContext().getString(R.string.schedule_type_text2));
            }
        } else if (id == R.id.tvType3) {
            dismiss();
            if (listener != null) {
                listener.click(getContext().getString(R.string.schedule_type_text3));
            }
        } else if (id == R.id.tvType4) {
            dismiss();
            if (listener != null) {
                listener.click(getContext().getString(R.string.schedule_type_text4));
            }
        }
    }

    private void setData() {

    }

    private Ilistener listener;

    public void setListener(Ilistener listener) {
        this.listener = listener;
    }

    public interface Ilistener {
        void click(String name);
    }
}
